home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Development Platforms / Macintosh Common Lisp Related / User Contributions / applescript-from-lisp / OSA.lisp next >
Encoding:
Text File  |  1994-06-16  |  25.5 KB  |  580 lines  |  [TEXT/CCL2]

  1. (in-package :TRAPS)             ; 
  2. ; ////////////////////////////////////////////////////////////////////////////
  3. ; ////
  4. ; // OPEN SCRIPTING ARCHITECTURE: Client Interface
  5. ; ////////////////////////////////////////////////////////////////////////////
  6. ; ////
  7. ; // Copyright   1992 Apple Computer, Inc. All rights reserved.
  8. ; // Authors: Jens Alfke, William Cook, Donn Denman, and Warren Harris
  9. ; ////////////////////////////////////////////////////////////////////////////
  10. ; ////
  11. ; // This interface defines what it means to be a "scripting component."
  12. ; // Scripting components allow "scripts" to be loaded and executed.  This
  13. ; // interface does not define the way in which a particular scripting
  14. ; // component's scripts are editing and debugged.
  15. ; ////////////////////////////////////////////////////////////////////////////
  16. ; ////
  17.  
  18. ; $IFC UNDEFINED UsingIncludes
  19. ; $SETC UsingIncludes := 0
  20. ; $ENDC
  21.  
  22. ; $IFC NOT UsingIncludes
  23.  
  24. ; $ENDC
  25.  
  26. ; $IFC UNDEFINED UsingOSA
  27. ; $SETC UsingOSA := 1
  28.  
  29. ; $I+
  30. ; $SETC OSAIncludes := UsingIncludes
  31. ; $SETC UsingIncludes := 1
  32. ; $IFC UNDEFINED UsingAppleEvents
  33.  
  34. (require-interface 'APPLEEVENTS); $I $$Shell(PInterfaces)AppleEvents.p
  35. ; $ENDC
  36. ; $IFC UNDEFINED UsingComponents
  37.  
  38. (require-interface 'COMPONENTS) ; $I $$Shell(PInterfaces)Components.p
  39. ; $ENDC
  40. ; $SETC UsingIncludes := OSAIncludes
  41.  
  42. ;  Types and Constants 
  43.  
  44. (defconstant $kOSAComponentType :|osa |)
  45. (defconstant $kOSAGenericScriptingComponentSubtype :|scpt|)
  46.  
  47. (def-mactype :OSAID (find-mactype :SIGNED-LONG))
  48. (def-mactype :OSAERROR (find-mactype :SIGNED-LONG))
  49.  
  50. (defconstant $kOSANullScript 0)
  51.  
  52. (defconstant $kOSAScriptResourceType #$KOSAGENERICSCRIPTINGCOMPONENTSUBTYPE)
  53. (defconstant $typeOSAGenericStorage #$KOSASCRIPTRESOURCETYPE)
  54.  
  55. ;  Error Codes 
  56. (defconstant $errOSACorruptData -1702);  Same as errAECorruptData 
  57. (defconstant $errOSASystemError -1750)
  58. (defconstant $errOSAInvalidID -1751)
  59. (defconstant $errOSABadStorageType -1752)
  60. (defconstant $errOSAScriptError -1753)
  61. (defconstant $errOSABadSelector -1754)
  62. (defconstant $errOSAInvalidAccess -1755)
  63. (defconstant $errOSARecordingIsAlreadyOn -30009)
  64.  
  65. ; ////////////////////////////////////////////////////////////////////////////
  66. ; ////
  67. ; // OSA Interface Descriptions
  68. ; ////////////////////////////////////////////////////////////////////////////
  69. ; ////
  70. ; // The OSA Interface is broken down into a required interface, and several
  71. ; // optional interfaces to support additional functionality.  A given
  72. ; scripting
  73. ; // component may choose to support only some of the optional interfaces in
  74. ; // addition to the basic interface.  The OSA Component Flags may be used to
  75. ; // query the Component Manager to find a scripting component with a
  76. ; particular
  77. ; // capability, or determine if a particular scripting component supports a 
  78. ; // particular capability.
  79. ; ////////////////////////////////////////////////////////////////////////////
  80. ; ////
  81.  
  82. ;  OSA Component Flags 
  83. (defconstant $kOSASupportsCompiling 1)
  84. (defconstant $kOSASupportsGetSource 2)
  85. (defconstant $kOSASupportsAECoercion 4)
  86. (defconstant $kOSASupportsAESending 8)
  87. (defconstant $kOSASupportsRecording 16)
  88. (defconstant $kOSASupportsWindowEditing 32)
  89. (defconstant $kOSASupportsDialects 64)
  90. (defconstant $kOSASupportsTinkering 128)
  91.  
  92. ;  Component Selectors 
  93. ;  Basic Scripting: 
  94. (defconstant $kOSASelectLoad #X1)
  95. (defconstant $kOSASelectStore #X2)
  96. (defconstant $kOSASelectExecute #X3)
  97. (defconstant $kOSASelectDisplay #X4)
  98. (defconstant $kOSASelectScriptError #X5)
  99. (defconstant $kOSASelectDispose #X6)
  100. (defconstant $kOSASelectSetScriptInfo #X7)
  101. (defconstant $kOSASelectGetScriptInfo #X8)
  102. (defconstant $kOSASelectSetActiveProc #X9)
  103. (defconstant $kOSASelectGetActiveProc #XA)
  104. ;  Compiling: 
  105. (defconstant $kOSASelectExactScriptingComponent #X101)
  106. (defconstant $kOSASelectScriptingComponentName #X102)
  107. (defconstant $kOSASelectCompile #X103)
  108. (defconstant $kOSASelectCopyID #X104)
  109. ;  GetSource: 
  110. (defconstant $kOSASelectGetSource #X201)
  111. ;  AECoercion: 
  112. (defconstant $kOSASelectCoerceFromDesc #X301)
  113. (defconstant $kOSASelectCoerceToDesc #X302)
  114. ;  AESending: 
  115. (defconstant $kOSASelectSetSendProc #X401)
  116. (defconstant $kOSASelectGetSendProc #X402)
  117. (defconstant $kOSASelectSetCreateProc #X403)
  118. (defconstant $kOSASelectGetCreateProc #X404)
  119. ;  Recording: 
  120. (defconstant $kOSASelectStartRecording #X501)
  121. (defconstant $kOSASelectStopRecording #X502)
  122. ;  WindowEditing:
  123. ;       kOSASelectOpenEditor                            = $0601;
  124. ;       kOSASelectCloseEditor                           = $0602;
  125. ;       { Dialects: 
  126. (defconstant $kOSASelectSetCurrentDialect #X701)
  127. (defconstant $kOSASelectGetCurrentDialect #X702)
  128. (defconstant $kOSASelectAvailableDialects #X703)
  129. ;  Tinkering: 
  130. (defconstant $kOSASelectExecuteEvent #X801)
  131. (defconstant $kOSASelectMakeContext #X802)
  132.  
  133. (defconstant $kOSASelectComponentSpecificStart #X1001)
  134. ;  scripting component specific selectors are added beginning with this 
  135. ;         value 
  136.  
  137. ; ////////////////////////////////////////////////////////////////////////////
  138. ; ////
  139. ; // OSA Basic Scripting Interface
  140. ; ////////////////////////////////////////////////////////////////////////////
  141. ; ////
  142. ; // Scripting components must at least support the Basic Scripting
  143. ; interface.
  144. ; ////////////////////////////////////////////////////////////////////////////
  145. ; ////
  146.  
  147. ;  Loading and Storing Scripts 
  148.  
  149.  
  150. (deftrap _OSALOAD ((SCRIPTINGCOMPONENT (:POINTER :COMPONENTINSTANCERECORD))
  151.                    (SCRIPTDATA :AEDESC) (RESULTINGSCRIPTID (:POINTER :SIGNED-LONG)))
  152.          (:STACK :SIGNED-LONG)
  153.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTDATA RESULTINGSCRIPTID
  154.                ((+ (ASH 8 16) 1) :SIGNED-LONGINT)))
  155.  
  156.  
  157. (deftrap _OSASTORE ((SCRIPTINGCOMPONENT (:POINTER :COMPONENTINSTANCERECORD))
  158.                     (SCRIPTID :SIGNED-LONG) (DESIREDTYPE :OSTYPE) (RESULTINGSCRIPTDATA (:POINTER
  159.                                                                                         :AEDESC)))
  160.          (:STACK :SIGNED-LONG)
  161.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTID DESIREDTYPE
  162.                RESULTINGSCRIPTDATA ((+ (ASH 12 16) 2) :SIGNED-LONGINT)))
  163.  
  164. ;  Executing Scripts 
  165.  
  166.  
  167. (deftrap _OSAEXECUTE ((SCRIPTINGCOMPONENT (:POINTER :COMPONENTINSTANCERECORD))
  168.                       (COMPILEDSCRIPTID :SIGNED-LONG) (CONTEXTID :SIGNED-LONG) (MODEFLAGS
  169.                                                                                 :SIGNED-LONG) (RESULTINGSCRIPTVALUEID (:POINTER :SIGNED-LONG)))
  170.          (:STACK :SIGNED-LONG)
  171.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT COMPILEDSCRIPTID CONTEXTID
  172.                MODEFLAGS RESULTINGSCRIPTVALUEID ((+ (ASH 16 16) 3) :SIGNED-LONGINT)))
  173.  
  174. ;  Displaying Results 
  175.  
  176.  
  177. (deftrap _OSADISPLAY ((SCRIPTINGCOMPONENT (:POINTER :COMPONENTINSTANCERECORD))
  178.                       (SCRIPTVALUEID :SIGNED-LONG) (DESIREDTYPE :OSTYPE) (MODEFLAGS :SIGNED-LONG)
  179.                       (RESULTINGTEXT (:POINTER :AEDESC)))
  180.          (:STACK :SIGNED-LONG)
  181.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTVALUEID DESIREDTYPE
  182.                MODEFLAGS RESULTINGTEXT ((+ (ASH 16 16) 4) :SIGNED-LONGINT)))
  183.  
  184. ;  Getting Error Information 
  185.  
  186.  
  187. (deftrap _OSASCRIPTERROR ((SCRIPTINGCOMPONENT (:POINTER
  188.                                                :COMPONENTINSTANCERECORD)) (SELECTOR :OSTYPE) (DESIREDTYPE :OSTYPE)
  189.                           (RESULTINGERRORDESCRIPTION (:POINTER :AEDESC)))
  190.          (:STACK :SIGNED-LONG)
  191.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SELECTOR DESIREDTYPE
  192.                RESULTINGERRORDESCRIPTION ((+ (ASH 12 16) 5) :SIGNED-LONGINT)))
  193.  
  194. ;  OSAScriptError selectors: 
  195. (defconstant $kOSAErrorNumber :|errn|)
  196. (defconstant $kOSAErrorMessage :|errs|)
  197. (defconstant $kOSAErrorBriefMessage :|errb|)
  198. (defconstant $kOSAErrorApp :|erap|)
  199. (defconstant $kOSAErrorPartialResult :|ptlr|)
  200. (defconstant $kOSAErrorOffendingObject :|erob|)
  201. (defconstant $kOSAErrorRange :|erng|)
  202.  
  203. ;  text ranges: 
  204. (defconstant $typeOSAErrorRange :|erng|)
  205. (defconstant $keySourceStart :|srcs|)
  206. (defconstant $keySourceEnd :|srce|)
  207.  
  208. ;  Disposing Script IDs 
  209.  
  210.  
  211. (deftrap _OSADISPOSE ((SCRIPTINGCOMPONENT (:POINTER :COMPONENTINSTANCERECORD))
  212.                       (SCRIPTID :SIGNED-LONG))
  213.          (:STACK :SIGNED-LONG)
  214.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTID ((+ (ASH 4 16) 6)
  215.                                                          :SIGNED-LONGINT)))
  216.  
  217. ;  Getting and Setting Script Information 
  218.  
  219.  
  220. (deftrap _OSASETSCRIPTINFO ((SCRIPTINGCOMPONENT (:POINTER
  221.                                                  :COMPONENTINSTANCERECORD)) (SCRIPTID :SIGNED-LONG) (SELECTOR :OSTYPE) (VALUE
  222.                                                                                                                         :SIGNED-LONG))
  223.          (:STACK :SIGNED-LONG)
  224.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTID SELECTOR VALUE ((+
  225.                                                                          (ASH 12 16) 7) :SIGNED-LONGINT)))
  226.  
  227.  
  228. (deftrap _OSAGETSCRIPTINFO ((SCRIPTINGCOMPONENT (:POINTER
  229.                                                  :COMPONENTINSTANCERECORD)) (SCRIPTID :SIGNED-LONG) (SELECTOR :OSTYPE) (RESULT
  230.                                                                                                                         (:POINTER :SIGNED-LONG)))
  231.          (:STACK :SIGNED-LONG)
  232.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTID SELECTOR RESULT ((+
  233.                                                                           (ASH 12 16) 8) :SIGNED-LONGINT)))
  234.  
  235. ;  selectors 
  236. (defconstant $kOSAScriptIsModified :|modi|)
  237. (defconstant $kOSAScriptIsBeingEdited :|edit|)
  238. (defconstant $kOSAScriptIsBeingRecorded :|recd|)
  239. (defconstant $kOSAScriptIsTypeCompiledScript :|cscr|)
  240. (defconstant $kOSAScriptIsTypeScriptValue :|valu|)
  241. (defconstant $kOSAScriptIsTypeScriptContext :|cntx|)
  242. (defconstant $kOSAScriptBestType :|best|)
  243.  
  244. ;  Manipulating the ActiveProc 
  245.  
  246. (def-mactype :OSAACTIVEPROCPTR (find-mactype :POINTER))
  247.  
  248.  
  249. (deftrap _OSASETACTIVEPROC ((SCRIPTINGCOMPONENT (:POINTER
  250.                                                  :COMPONENTINSTANCERECORD)) (ACTIVEPROC :POINTER) (REFCON :SIGNED-LONG))
  251.          (:STACK :SIGNED-LONG)
  252.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT ACTIVEPROC REFCON ((+ (ASH 8
  253.                                                                           16) 9) :SIGNED-LONGINT)))
  254.  
  255.  
  256. (deftrap _OSAGETACTIVEPROC ((SCRIPTINGCOMPONENT (:POINTER
  257.                                                  :COMPONENTINSTANCERECORD)) (ACTIVEPROC (:POINTER :POINTER)) (REFCON (:POINTER
  258.                                                                                                                       :SIGNED-LONG)))
  259.          (:STACK :SIGNED-LONG)
  260.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT ACTIVEPROC REFCON ((+ (ASH 8
  261.                                                                           16) 10) :SIGNED-LONGINT)))
  262.  
  263. ; ////////////////////////////////////////////////////////////////////////////
  264. ; ////
  265. ; // OSA Optional Compiling Interface
  266. ; ////////////////////////////////////////////////////////////////////////////
  267. ; ////
  268. ; // Scripting components that support the Compiling interface have the 
  269. ; // kOSASupportsCompiling bit set in it's ComponentDescription.
  270. ; ////////////////////////////////////////////////////////////////////////////
  271. ; ////
  272.  
  273.  
  274. (deftrap _OSAEXACTSCRIPTINGCOMPONENT ((SCRIPTINGCOMPONENT (:POINTER
  275.                                                            :COMPONENTINSTANCERECORD)) (SCRIPTID :SIGNED-LONG) (EXACTSCRIPTINGCOMPONENT
  276.                                                                                                                (:POINTER (:POINTER :COMPONENTINSTANCERECORD))))
  277.          (:STACK :SIGNED-LONG)
  278.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTID
  279.                EXACTSCRIPTINGCOMPONENT ((+ (ASH 8 16) 257) :SIGNED-LONGINT)))
  280.  
  281.  
  282. (deftrap _OSASCRIPTINGCOMPONENTNAME ((SCRIPTINGCOMPONENT (:POINTER
  283.                                                           :COMPONENTINSTANCERECORD)) (RESULTINGSCRIPTINGCOMPONENTNAME (:POINTER
  284.                                                                                                                        :AEDESC)))
  285.          (:STACK :SIGNED-LONG)
  286.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT RESULTINGSCRIPTINGCOMPONENTNAME
  287.                ((+ (ASH 4 16) 258) :SIGNED-LONGINT)))
  288.  
  289.  
  290. (deftrap _OSACOMPILE ((SCRIPTINGCOMPONENT (:POINTER :COMPONENTINSTANCERECORD))
  291.                       (SOURCEDATA :AEDESC) (MODEFLAGS :SIGNED-LONG) (RESULTINGCOMPILEDSCRIPTID
  292.                                                                      (:POINTER :SIGNED-LONG)))
  293.          (:STACK :SIGNED-LONG)
  294.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SOURCEDATA MODEFLAGS
  295.                RESULTINGCOMPILEDSCRIPTID ((+ (ASH 12 16) 259) :SIGNED-LONGINT)))
  296.  
  297.  
  298. (deftrap _OSACOPYID ((SCRIPTINGCOMPONENT (:POINTER :COMPONENTINSTANCERECORD))
  299.                      (FROMID :SIGNED-LONG) (TOID (:POINTER :SIGNED-LONG)))
  300.          (:STACK :SIGNED-LONG)
  301.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT FROMID TOID ((+ (ASH 8 16) 260)
  302.                                                             :SIGNED-LONGINT)))
  303.  
  304. ; ////////////////////////////////////////////////////////////////////////////
  305. ; ////
  306. ; // OSA Optional GetSource Interface
  307. ; ////////////////////////////////////////////////////////////////////////////
  308. ; ////
  309. ; // Scripting components that support the GetSource interface have the 
  310. ; // kOSASupportsGetSource bit set in it's ComponentDescription.
  311. ; ////////////////////////////////////////////////////////////////////////////
  312. ; ////
  313.  
  314.  
  315. (deftrap _OSAGETSOURCE ((SCRIPTINGCOMPONENT (:POINTER
  316.                                              :COMPONENTINSTANCERECORD)) (SCRIPTID :SIGNED-LONG) (DESIREDTYPE :OSTYPE)
  317.                         (RESULTINGSOURCEDATA (:POINTER :AEDESC)))
  318.          (:STACK :SIGNED-LONG)
  319.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTID DESIREDTYPE
  320.                RESULTINGSOURCEDATA ((+ (ASH 12 16) 513) :SIGNED-LONGINT)))
  321.  
  322. ; ////////////////////////////////////////////////////////////////////////////
  323. ; ////
  324. ; // OSA Optional AECoercion Interface
  325. ; ////////////////////////////////////////////////////////////////////////////
  326. ; ////
  327. ; // Scripting components that support the AECoercion interface have the 
  328. ; // kOSASupportsGetSource bit set in it's ComponentDescription.
  329. ; ////////////////////////////////////////////////////////////////////////////
  330. ; ////
  331.  
  332.  
  333. (deftrap _OSACOERCEFROMDESC ((SCRIPTINGCOMPONENT (:POINTER
  334.                                                   :COMPONENTINSTANCERECORD)) (SCRIPTDATA :AEDESC) (RESULTINGSCRIPTVALUEID
  335.                                                                                                    (:POINTER :SIGNED-LONG)))
  336.          (:STACK :SIGNED-LONG)
  337.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTDATA
  338.                RESULTINGSCRIPTVALUEID ((+ (ASH 8 16) 769) :SIGNED-LONGINT)))
  339.  
  340.  
  341. (deftrap _OSACOERCETODESC ((SCRIPTINGCOMPONENT (:POINTER
  342.                                                 :COMPONENTINSTANCERECORD)) (SCRIPTVALUEID :SIGNED-LONG) (DESIREDTYPE :OSTYPE)
  343.                            (RESULT (:POINTER :AEDESC)))
  344.          (:STACK :SIGNED-LONG)
  345.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SCRIPTVALUEID DESIREDTYPE
  346.                RESULT ((+ (ASH 12 16) 770) :SIGNED-LONGINT)))
  347.  
  348. ; ////////////////////////////////////////////////////////////////////////////
  349. ; ////
  350. ; // OSA Optional AESending Interface
  351. ; ////////////////////////////////////////////////////////////////////////////
  352. ; ////
  353. ; // Scripting components that support the AESending interface have the 
  354. ; // kOSASupportsAESending bit set in it's ComponentDescription.
  355. ; ////////////////////////////////////////////////////////////////////////////
  356. ; ////
  357.  
  358. (def-mactype :AESENDPROCPTR (find-mactype :POINTER))
  359. (def-mactype :AECREATEAPPLEEVENTPROCPTR (find-mactype :POINTER))
  360.  
  361. ;   The first two proc pointers have the following interfaces
  362. ;    taken from AppleEvents.p 
  363. ;    
  364. ;       FUNCTION AECreateAppleEvent(theAEEventClass: AEEventClass;
  365. ;                                                               theAEEventID: AEEventID;
  366. ;                                                               target: AEAddressDesc;
  367. ;                                                               returnID: INTEGER;
  368. ;                                                               transactionID: LONGINT;
  369. ;                                                               VAR result: AppleEvent): OSErr;
  370. ;       
  371. ;       FUNCTION AESend(theAppleEvent: AppleEvent;
  372. ;                                       VAR reply: AppleEvent;
  373. ;                                       sendMode: AESendMode;
  374. ;                                       sendPriority: AESendPriority;
  375. ;                                       timeOutInTicks: LONGINT;
  376. ;                                       idleProc: IdleProcPtr;
  377. ;                                       filterProc: EventFilterProcPtr): OSErr;
  378. ;       FUNCTION OSAActive(): OSErr;
  379.  
  380.  
  381. (deftrap _OSASETSENDPROC ((SCRIPTINGCOMPONENT (:POINTER
  382.                                                :COMPONENTINSTANCERECORD)) (SENDPROC :POINTER) (REFCON :SIGNED-LONG))
  383.          (:STACK :SIGNED-LONG)
  384.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SENDPROC REFCON ((+ (ASH 8 16)
  385.                                                                    1025) :SIGNED-LONGINT)))
  386.  
  387.  
  388. (deftrap _OSAGETSENDPROC ((SCRIPTINGCOMPONENT (:POINTER
  389.                                                :COMPONENTINSTANCERECORD)) (SENDPROC (:POINTER :POINTER)) (REFCON (:POINTER
  390.                                                                                                                   :SIGNED-LONG)))
  391.          (:STACK :SIGNED-LONG)
  392.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT SENDPROC REFCON ((+ (ASH 8 16)
  393.                                                                    1026) :SIGNED-LONGINT)))
  394.  
  395.  
  396. (deftrap _OSASETCREATEPROC ((SCRIPTSYSTEM (:POINTER :COMPONENTINSTANCERECORD))
  397.                             (CREATEPROC :POINTER) (REFCON :SIGNED-LONG))
  398.          (:STACK :SIGNED-LONG)
  399.   (:STACK-TRAP #xA82A :D0 0 SCRIPTSYSTEM CREATEPROC REFCON ((+ (ASH 8 16)
  400.                                                                1027) :SIGNED-LONGINT)))
  401.  
  402.  
  403. (deftrap _OSAGETCREATEPROC ((SCRIPTSYSTEM (:POINTER :COMPONENTINSTANCERECORD))
  404.                             (CREATEPROC (:POINTER :POINTER)) (REFCON (:POINTER :SIGNED-LONG)))
  405.          (:STACK :SIGNED-LONG)
  406.   (:STACK-TRAP #xA82A :D0 0 SCRIPTSYSTEM CREATEPROC REFCON ((+ (ASH 8 16)
  407.                                                                1028) :SIGNED-LONGINT)))
  408.  
  409. ; ////////////////////////////////////////////////////////////////////////////
  410. ; ////
  411. ; // OSA Optional Recording Interface
  412. ; ////////////////////////////////////////////////////////////////////////////
  413. ; ////
  414. ; // Scripting components that support the Recording interface have the 
  415. ; // kOSASupportsRecording bit set in it's ComponentDescription.
  416. ; ////////////////////////////////////////////////////////////////////////////
  417. ; ////
  418.  
  419.  
  420. (deftrap _OSASTARTRECORDING ((SCRIPTINGCOMPONENT (:POINTER
  421.                                                   :COMPONENTINSTANCERECORD)) (COMPILEDSCRIPTTOMODIFYID (:POINTER :SIGNED-LONG)))
  422.          (:STACK :SIGNED-LONG)
  423.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT COMPILEDSCRIPTTOMODIFYID ((+
  424.                                                                           (ASH 4 16) 1281) :SIGNED-LONGINT)))
  425.  
  426.  
  427. (deftrap _OSASTOPRECORDING ((SCRIPTINGCOMPONENT (:POINTER
  428.                                                  :COMPONENTINSTANCERECORD)) (COMPILEDSCRIPTID :SIGNED-LONG))
  429.          (:STACK :SIGNED-LONG)
  430.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT COMPILEDSCRIPTID ((+ (ASH 4 16)
  431.                                                                     1282) :SIGNED-LONGINT)))
  432.  
  433. ; ////////////////////////////////////////////////////////////////////////////
  434. ; ////
  435. ; // OSA Optional WindowEditing Interface
  436. ; ////////////////////////////////////////////////////////////////////////////
  437. ; ////
  438. ; // Scripting components that support the WindowEditing interface have the 
  439. ; // kOSASupportsWindowEditing bit set in it's ComponentDescription.
  440. ; ////////////////////////////////////////////////////////////////////////////
  441. ; ////
  442.  
  443.  
  444. (deftrap _OSAOPENEDITOR ((SCRIPTINGCOMPONENT (:POINTER
  445.                                               :COMPONENTINSTANCERECORD)) (COMPILEDSCRIPTTOMODIFYID (:POINTER :SIGNED-LONG)))
  446.          (:STACK :SIGNED-LONG)
  447.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT COMPILEDSCRIPTTOMODIFYID ((+
  448.                                                                           (ASH 4 16) 1537) :SIGNED-LONGINT)))
  449.  
  450.  
  451. (deftrap _OSACLOSEEDITOR ((SCRIPTINGCOMPONENT (:POINTER
  452.                                                :COMPONENTINSTANCERECORD)) (COMPILEDSCRIPTID :SIGNED-LONG))
  453.          (:STACK :SIGNED-LONG)
  454.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT COMPILEDSCRIPTID ((+ (ASH 4 16)
  455.                                                                     1538) :SIGNED-LONGINT)))
  456.  
  457. ; ////////////////////////////////////////////////////////////////////////////
  458. ; ////
  459. ; // OSA Optional Dialects Interface
  460. ; ////////////////////////////////////////////////////////////////////////////
  461. ; ////
  462. ; // Scripting components that support the Dialects interface have the 
  463. ; // kOSASupportsDialects bit set in it's ComponentDescription.
  464. ; ////////////////////////////////////////////////////////////////////////////
  465. ; ////
  466.  
  467.  
  468. (deftrap _OSASETCURRENTDIALECT ((SCRIPTINGCOMPONENT (:POINTER
  469.                                                      :COMPONENTINSTANCERECORD)) (DIALECTCODE :SIGNED-INTEGER))
  470.          (:STACK :SIGNED-LONG)
  471.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT DIALECTCODE ((+ (ASH 2 16)
  472.                                                                1793) :SIGNED-LONGINT)))
  473.  
  474.  
  475. (deftrap _OSAGETCURRENTDIALECT ((SCRIPTINGCOMPONENT (:POINTER
  476.                                                      :COMPONENTINSTANCERECORD)) (RESULTINGDIALECTCODE (:POINTER :SIGNED-INTEGER)))
  477.          (:STACK :SIGNED-LONG)
  478.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT RESULTINGDIALECTCODE ((+ (ASH 4
  479.                                                                              16) 1794) :SIGNED-LONGINT)))
  480.  
  481.  
  482. (deftrap _OSAAVAILABLEDIALECTS ((SCRIPTINGCOMPONENT (:POINTER
  483.                                                      :COMPONENTINSTANCERECORD)) (RESULTINGDIALECTINFOLIST (:POINTER :AEDESC)))
  484.          (:STACK :SIGNED-LONG)
  485.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT RESULTINGDIALECTINFOLIST ((+
  486.                                                                           (ASH 4 16) 1795) :SIGNED-LONGINT)))
  487.  
  488. (defconstant $typeOSADialectInfo :|difo|)
  489. (defconstant $keyOSADialectName :|dnam|)
  490. (defconstant $keyOSADialectCode :|dcod|)
  491.  
  492. ; ////////////////////////////////////////////////////////////////////////////
  493. ; ////
  494. ; // OSA Optional Tinkering Interface
  495. ; ////////////////////////////////////////////////////////////////////////////
  496. ; ////
  497. ; // Scripting components that support the Tinkering interface have the 
  498. ; // kOSASupportsTinkering bit set in it's ComponentDescription.
  499. ; ////////////////////////////////////////////////////////////////////////////
  500. ; ////
  501.  
  502.  
  503. (deftrap _OSAEXECUTEEVENT ((SCRIPTINGCOMPONENT (:POINTER
  504.                                                 :COMPONENTINSTANCERECORD)) (THEAPPLEEVENT :AEDESC) (CONTEXTID :SIGNED-LONG)
  505.                            (DEFAULTHANDLER :POINTER) (MODEFLAGS :SIGNED-LONG) (REPLY (:POINTER :AEDESC))
  506.                            (REFCON :SIGNED-LONG))
  507.          (:STACK :SIGNED-LONG)
  508.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT THEAPPLEEVENT CONTEXTID
  509.                DEFAULTHANDLER MODEFLAGS REPLY REFCON ((+ (ASH 24 16) 2049) :SIGNED-LONGINT)))
  510.  
  511.  
  512. (deftrap _OSAMAKECONTEXT ((SCRIPTINGCOMPONENT (:POINTER
  513.                                                :COMPONENTINSTANCERECORD)) (CONTEXTNAME (:POINTER (:STRING 255)))
  514.                           (PARENTCONTEXT :SIGNED-LONG) (RESULTINGCONTEXTID (:POINTER :SIGNED-LONG)))
  515.          (:STACK :SIGNED-LONG)
  516.   (:STACK-TRAP #xA82A :D0 0 SCRIPTINGCOMPONENT CONTEXTNAME PARENTCONTEXT
  517.                RESULTINGCONTEXTID ((+ (ASH 12 16) 2050) :SIGNED-LONGINT)))
  518.  
  519. ; $ENDC                         ;  UsingOSA 
  520.  
  521. ; $IFC NOT UsingIncludes
  522.  
  523. ; $ENDC
  524.  
  525. (export '($KEYOSADIALECTCODE $KEYOSADIALECTNAME $TYPEOSADIALECTINFO
  526.           $KOSASCRIPTBESTTYPE $KOSASCRIPTISTYPESCRIPTCONTEXT
  527.           $KOSASCRIPTISTYPESCRIPTVALUE $KOSASCRIPTISTYPECOMPILEDSCRIPT
  528.           $KOSASCRIPTISBEINGRECORDED $KOSASCRIPTISBEINGEDITED
  529.           $KOSASCRIPTISMODIFIED $KEYSOURCEEND $KEYSOURCESTART
  530.           $TYPEOSAERRORRANGE $KOSAERRORRANGE $KOSAERROROFFENDINGOBJECT
  531.           $KOSAERRORPARTIALRESULT $KOSAERRORAPP $KOSAERRORBRIEFMESSAGE
  532.           $KOSAERRORMESSAGE $KOSAERRORNUMBER $KOSASELECTCOMPONENTSPECIFICSTART
  533.           $KOSASELECTMAKECONTEXT $KOSASELECTEXECUTEEVENT
  534.           $KOSASELECTAVAILABLEDIALECTS $KOSASELECTGETCURRENTDIALECT
  535.           $KOSASELECTSETCURRENTDIALECT $KOSASELECTSTOPRECORDING
  536.           $KOSASELECTSTARTRECORDING $KOSASELECTGETCREATEPROC
  537.           $KOSASELECTSETCREATEPROC $KOSASELECTGETSENDPROC
  538.           $KOSASELECTSETSENDPROC $KOSASELECTCOERCETODESC
  539.           $KOSASELECTCOERCEFROMDESC $KOSASELECTGETSOURCE $KOSASELECTCOPYID
  540.           $KOSASELECTCOMPILE $KOSASELECTSCRIPTINGCOMPONENTNAME
  541.           $KOSASELECTEXACTSCRIPTINGCOMPONENT $KOSASELECTGETACTIVEPROC
  542.           $KOSASELECTSETACTIVEPROC $KOSASELECTGETSCRIPTINFO
  543.           $KOSASELECTSETSCRIPTINFO $KOSASELECTDISPOSE $KOSASELECTSCRIPTERROR
  544.           $KOSASELECTDISPLAY $KOSASELECTEXECUTE $KOSASELECTSTORE
  545.           $KOSASELECTLOAD $KOSASUPPORTSTINKERING $KOSASUPPORTSDIALECTS
  546.           $KOSASUPPORTSWINDOWEDITING $KOSASUPPORTSRECORDING
  547.           $KOSASUPPORTSAESENDING $KOSASUPPORTSAECOERCION $KOSASUPPORTSGETSOURCE
  548.           $KOSASUPPORTSCOMPILING $ERROSARECORDINGISALREADYON
  549.           $ERROSAINVALIDACCESS $ERROSABADSELECTOR $ERROSASCRIPTERROR
  550.           $ERROSABADSTORAGETYPE $ERROSAINVALIDID $ERROSASYSTEMERROR
  551.           $ERROSACORRUPTDATA $TYPEOSAGENERICSTORAGE $KOSASCRIPTRESOURCETYPE
  552.           $KOSANULLSCRIPT $KOSAGENERICSCRIPTINGCOMPONENTSUBTYPE
  553.           $KOSACOMPONENTTYPE))
  554. (provide-interface 'osa)
  555.